﻿.ant-form-item-has-success .ant-input, .ant-form-item-has-success .ant-input-affix-wrapper, .ant-form-item-has-success .ant-input:hover, .ant-form-item-has-success .ant-input-affix-wrapper:hover {
    background-color: #fff;
    border-color: #52c41a;
}

.ant-checkbox-wrapper {
    cursor: default;

    &-pointer {
        cursor: pointer;
    }
}

.ant-input-group {
    > .ant-input-group-addon {
        &:last-child > .ant-btn {
            border-top-left-radius: 0;
            border-bottom-left-radius: 0;
        }

        &:first-child > .ant-btn {
            border-top-right-radius: 0;
            border-bottom-right-radius: 0;
        }
    }
}

.ant-input-group {
    > .ant-select-selection-search-input {
        &:first-child {
            > .ant-select-selector {
                border-right: 0;
                border-top-right-radius: 0 !important;
                border-bottom-right-radius: 0 !important;
            }
        }

        &:nth-child(2) {
            > .ant-select-selector {
                border-left: 0;
                border-top-left-radius: 0 !important;
                border-bottom-left-radius: 0 !important;
            }
        }
    }
}

.ant-input-search-enter-button .ant-input-group-addon {
    padding: 0;
    border: 0;

    &:last-child .ant-btn {
        border-top-left-radius: 0;
        border-bottom-left-radius: 0;
    }

    &:first-child .ant-btn {
        border-top-right-radius: 0;
        border-bottom-right-radius: 0;
    }
}

.ant-row.ant-form-row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -$form-grid-gutter-width / 2;
    margin-left: -$form-grid-gutter-width / 2;

    > .ant-col,
    > [class*="ant-col-"] {
        padding-right: $form-grid-gutter-width / 2;
        padding-left: $form-grid-gutter-width / 2;

        .ant-form-item-label {
            padding-right: 0;
            padding-left: 0;
        }
    }
}

.ant-form-item {
    > .ant-col.ant-form-item-label {
        padding-right: 0;
        padding-left: 0;
    }

    &.ant-row {
        > .ant-col + .ant-col {
            padding-left: 0;
        }
    }

    .ant-select {
        width: 100%;
    }
}

.ant-input {
    height: 32px;
}

.ant-input-xs {
    padding: 0px 7px;
    font-size: 10px;
    height: 16px;
}

.ant-input-sm {
    padding: 0px 9px;
    font-size: 12px;
    height: 24px;
}

.ant-input-md {
    padding: 4.5px 11px;
    font-size: 14px;
    height: 36px;
}

.ant-input-lg {
    padding: 6.5px 13px;
    font-size: 16px;
    height: 40px;
}

.ant-input-xl {
    padding: 8.5px 15px;
    font-size: 18px;
    height: 48px;
}


.ant-input-group-wrapper-xs {
    > .ant-input-wrapper {
        > .ant-input-group-addon {
            > .control {
                .ant-btn {
                    @extend .ant-btn-xs;
                }
            }
        }

        .ant-input {
            @extend .ant-input-xs;
        }
    }
}

.ant-input-group-wrapper-sm {
    > .ant-input-wrapper {
        > .ant-input-group-addon {
            > .control {
                .ant-btn {
                    @extend .ant-btn-sm;
                }
            }
        }

        .ant-input {
            @extend .ant-input-sm;
        }
    }
}


.ant-input-group-wrapper-md {
    > .ant-input-wrapper {
        > .ant-input-group-addon {
            > .control {
                .ant-btn {
                    @extend .ant-btn-md;
                }
            }
        }

        .ant-input {
            @extend .ant-input-md;
        }
    }
}

.ant-input-group-wrapper-lg {
    > .ant-input-wrapper {
        > .ant-input-group-addon {
            > .control {
                .ant-btn {
                    @extend .ant-btn-lg;
                }
            }
        }

        .ant-input {
            @extend .ant-input-lg;
        }
    }
}

.ant-input-group-wrapper-xl {
    > .ant-input-wrapper {
        > .ant-input-group-addon {
            > .control {
                .ant-btn {
                    @extend .ant-btn-xl;
                }
            }
        }

        .ant-input {
            @extend .ant-input-xl;
        }
    }
}


@mixin select-size($name, $font-size, $height, $line-height) {
    .ant-select-#{$name} {
        font-size: $font-size;
    }

    .ant-select-single.ant-select-#{$name}:not(.ant-select-customize-input) .ant-select-selector {
        height: $height;
    }

    .ant-select-single.ant-select-#{$name}:not(.ant-select-customize-input) .ant-select-selector .ant-select-selection-item,
    .ant-select-single.ant-select-#{$name}:not(.ant-select-customize-input) .ant-select-selector .ant-select-selection-placeholder {
        line-height: $line-height;
    }

    .ant-select-single.ant-select-#{$name}:not(.ant-select-customize-input):not(.ant-select-customize-input) .ant-select-selection-search-input {
        height: $height;
    }
}

@include select-size('xs', 10px, 16px, 14px);
@include select-size('md', 14px, 36px, 34px);
@include select-size('xl', 18px, 48px, 45px);

@mixin checkbox($size, $width, $height) {
    .ant-checkbox-input.ant-checkbox-input-#{$size} {
        + .ant-checkbox-inner {
            width: $width;
            height: $height;
        }
    }

    .ant-checkbox.ant-checkbox-checked {
        > .ant-checkbox-input.ant-checkbox-input-#{$size} {
            + .ant-checkbox-inner {
                &::after {
                    width: $width / 3;
                    height: $height / 1.7;
                }
            }
        }
    }
}

@include checkbox('xs', $check-xs-height, $check-xs-height);
@include checkbox('sm', $check-sm-height, $check-sm-height);
@include checkbox('md', $check-md-height, $check-md-height);
@include checkbox('lg', $check-lg-height, $check-lg-height);
@include checkbox('xl', $check-xl-height, $check-xl-height);


.ant-radio-group.ant-radio-group-vertical {
    .ant-radio-wrapper {
        display: block;
        height: $radio-height * 2;
        line-height: $radio-height * 2;
    }

    .ant-radio-button-wrapper {
        display: block;
    }
}

@mixin radio($size, $radio-size) {
    $radio-dot-size: $radio-size - ($radio-size / 2);

    .ant-radio {
        > .ant-radio-input.ant-radio-input-#{$size} {
            + .ant-radio-inner {
                width: $radio-size;
                height: $radio-size;
            }
        }

        &.ant-radio-checked {
            > .ant-radio-input.ant-radio-input-#{$size} {
                + .ant-radio-inner {
                    &::after {
                        width: $radio-dot-size;
                        height: $radio-dot-size;
                        top: ($radio-size - $radio-dot-size) / 2 - 1px;
                        left: ($radio-size - $radio-dot-size) / 2 - 1px;
                    }
                }
            }
        }
    }
}

@include radio('xs', $radio-xs-height);
@include radio('sm', $radio-sm-height);
@include radio('md', $radio-md-height);
@include radio('lg', $radio-lg-height);
@include radio('xl', $radio-xl-height);

textarea.ant-input.ant-input-static {
    background-color: transparent;
    border-color: transparent;
    box-shadow: none;
    padding-left: 0;
    padding-right: 0;
}

.ant-focus-trap {
    display: contents;
}

.ant-form-item-label-required:after {
    content: " *";
    color: var(--b-theme-danger, $danger);
}
